#ifndef _AME_MOB_H_
#define _AME_MOB_H_

struct world_achar;

struct world_mob {
	unsigned int id;
	unsigned short subid;
	char name[16];
	unsigned long nextAction;
	struct world_cell *cell;
	struct world_char *target;
	struct chain_node *position;
	struct chain_set *steps;
	struct chain_set *objects;
	
	struct {
		unsigned hp: 32;
		unsigned sp: 32;
		unsigned walking: 1;
		unsigned attacking: 1;
		unsigned chatting: 1;
		unsigned dead: 1;
		unsigned lazy: 1; 
	} status;
	struct {
		unsigned wspeed: 4; // Walking speed
		unsigned aspeed: 4; // Attack speed
		unsigned f_damage: 4; // Phisical damage 0-100%
		unsigned m_damage: 4; // Magical damage 0-100%
		unsigned f_def: 4; // Phisical defence 0-100%
		unsigned m_def: 4; // Defence from magic 0-100%
		unsigned view_radius: 4;
		unsigned int_: 4; // Inteligence  - Magii stat
		unsigned dex_: 4; // Dexterity    - Range stat
		unsigned str_: 4; // Strength     - Rogue stat
		unsigned vit_: 4; // Vitality     - Melee stat
		unsigned res_: 4; // Resistance
		unsigned chr_: 4; // Charisma   / trash stats
	} stats;
};

/* AI sorta, sorta AI */
int mob_sees_char (struct world_mob *, struct world_char *);
int mob_dies(struct world_mob *);
int mob_do(struct world_mob *);
int mob_random_walk(struct world_mob *);
void mob_chats(struct world_mob *, int, const char *);
struct world_mob *mob_init(const char *name, struct world_cell *cell, int id, int subid);
void mob_shut(struct world_mob *);
int mob_attacked(struct world_mob *, struct world_char *);
int mob_getStatus(struct world_mob *);
int mob_getsDamage(struct world_mob *, int, struct world_char *);
#endif
